<template lang="pug">
  kalix-dialog.user-add(title='修改' bizKey="vote" ref="kalixBizDialog" v-bind:formModel.sync="formModel" v-bind:targetURL="targetURL")
    div.el-form(slot="dialogFormSlot")
      el-form-item(label="相册名称" prop="votetitle" v-bind:label-width="labelWidth")
        el-input(v-model="formModel.votetitle")
      el-form-item(label="选项一" prop="option1" v-bind:label-width="labelWidth" v-bind:rules="rules.option1")
        kalix-select(v-model="formModel.option1" v-bind:requestUrl="MessageURL" appName="messageColumn"  placeholder="请选择投票主题"
        v-bind:paramObj="messageParam" v-bind:defaultSelect="true" v-on:selectChange="setGroup" label="messageContent")

</template>

<script type="text/ecmascript-6">
  import {MessageURL, MpliveVoteURL} from '../../config.toml'
  import FormModel from './model'

  export default {
    name: 'VoteEdit',
    data() {
      return {
        fileList: [],
        MessageURL: MessageURL,
        messageParam: undefined,
        formModel: Object.assign({}, FormModel),
        labelWidth: '120px',
        rules: {
          option1: [{required: true, message: '请选择投票主题', trigger: 'blur'}],
          votetitle: [{required: true, message: '请填投票主题', trigger: 'blur'}]
        },
        targetURL: MpliveVoteURL
      }
    },
    methods: {
      init(dialogOption) {
        console.log('---------dialogOption------------', dialogOption)
      },
      setGroup(item) {
        console.log('========setGroup item===============', item)
        this.formModel.option1 = item.messageContent
      }
    }
  }
</script>

<style scoped lang="stylus" type="text/stylus">

</style>
